$(function () {

    var cm = [{
        // title: '选择',
        checkbox: true

    }, {
        field: 'Id',
        visible: false
    }, {
        field: 'u_name',
        title: '用户名'
        // formatter: NameFormatter
    }, {
        field: 'u_title',
        width: '',
        title: '昵称'
    }, {
        field: 'u_group',
        title: '用户组'
    }, {
        field: 'u_tf',
        title: '状态',
        formatter: TF_Formatter
    }];
    goTable($('#' + goUrlAction() + 'Table'), '/admin/views/' + goUrlAction() + '/list', cm);

});

function TF_Formatter(value, row, index) {
    var tf = value
    var tt = ""
    if (parseInt(tf) == 1) {
        tt = 'checked'
    }
    var tmp
    tmp = '<label style="margin-bottom: -5px;" class="switch switch-sm switch-icon switch-pill switch-primary">';
    tmp += '<input type="checkbox" class="switch-input" ' + tt + '>';
    tmp += '<span class="switch-label" data-on="&#xf00c" data-off="&#xf00d"></span>';
    tmp += '<span  class="switch-handle"></span></label>';
    //alert(tmp);
    return [tmp].join('');
};

//Form表单验证
function userValidatorRules() {
     var sRules = {
        u_name: 'required',
        u_title: 'required',

        u_email: {
            required: true,
            email: true
        }//,
        //agree: 'required'
    };
    return sRules;
}

